package com.im;

import mapgenerator.*;
import java.awt.Dimension;
import java.io.File;
import javax.swing.JPanel;

/**
 * Created on Feb 21, 2009, 00:24:53 AM
 *
 * @author Sajarwo Anggai
 */
public class IMPanelWidget extends JPanel {
    
    private Main comp;

    /**
     * IMPanelWidget digunakan untuk menampilkan semua panel widget pada Image Manager
     * @param render komponen untuk menampilkan widget
     * @param comp Main program
     */
    public IMPanelWidget(Main comp) {
        this.comp = comp;
        setLayout(null);
        reloadAll();
    }

    /**
     * Menampilkan semua panel widget disebelah kiri pada Image Manager
     */
    public void reloadAll() {
        comp.imControlPanel.showImgeManagerInfo(false);
        removeAll();
        for (int i = 0; i < comp.imContainer.getImages().size(); i++) {
            IMPanelWidgetPreview jp = new IMPanelWidgetPreview(comp, comp.project.getImageDir() + File.separator + comp.imContainer.getImages().get(i));
            jp.setBounds(0, 110 * i, 173, 100);
            add(jp);            
        }
        setPreferredSize(new Dimension(173, comp.imContainer.getImages().size() * 110));
        repaint();
        revalidate();
        comp.ImageManagerRightPanelRender.removeAll();
        comp.ImageManagerRightPanelRender.repaint();
        comp.ImageManagerRightPanelRender.revalidate();
    }
}
